import service from '@/utils/request';

// 获取维修申请列表
export function getSupports() {
    return service.get('/supports').then(res => {
        // 确保返回数组格式
        return Array.isArray(res) ? res : (res.data || []);
    });
}

// 新增维修申请
export function addSupport(data) {
    return service.post('/supports', data);
}

// 更新维修申请
export function updateSupport(data) {
    return service.put(`/supports/${data.requestId}`, data);
}

// 删除维修申请
export function deleteSupport(id) {
    return service.delete(`/supports/${id}`);
}